package com.cx.base.apiModel;

import java.io.Serializable;

import org.apache.commons.lang.StringUtils;

import com.cx.base.autoDoc.annotations.AutoDocField;

/**
 * 定义装载实体对象
 * 
 * @param <T>
 */
public class ApiModel<T>  implements Serializable{


	private static final long serialVersionUID = -4235000009767703449L;
	
	@AutoDocField("返回状态（0：成功，-1:数据出错,-2:异常）")
	private String status;
	
	@AutoDocField("返回描述")
	private String errorMsg;
	
	@AutoDocField("返回内容")
	private T body;

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getErrorMsg() {
		return errorMsg;
	}

	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}

	public T getBody() {
		return body;
	}

	public void setBody(T body) {
		this.body = body;
	}

	@Override
	public String toString() {
		return "ApiModel [status=" + status + ", errorMsg=" + errorMsg
				+ ", body=" + body + "]";
	}

	public ApiModel(String status, String errorMsg, T body) {
		super();
		this.status = status;
		this.errorMsg = StringUtils.isNotBlank(errorMsg) ? errorMsg : "";
		this.body = body;
	}

	public ApiModel() {
		super();
	}

}
